<?php
/**
 * Created by PhpStorm.
 * User: zl
 * Date: 2017/5/31
 * Time: 15:59
 */
    require_once('../BusinessApprove/BusinessApp.php');
    require_once ('../LoanFee/LoanFee.php');
    require_once('../Common.php');

    $data = $_POST;

    $result_array = array();
    if(!$data) {
        $result_array['state'] = 0;
        $result_array['state_error'] = 'POST_ERROR';
        exit($result_array);

    }

    $b_app = new BusinessApp();
        //function ApproveBussiness($appID, $userID, $type, $opinion, $opinion_detail){
    $r = $b_app->ApproveBussiness($data['approve_id'], $data['userID'], $data['approve_state'], $data['busi_opinion']['app_opinion'], $data['busi_opinion']['app_opinion_detail']);
    

    if($r){
        if($data['approveBusi'] == 1){
            $r = $b_app->ApproveLoanCar($data['approve_id'], $data['userID'], $data['approve_state'], $data['car_opinion']['app_opinion'], $data['car_opinion']['app_opinion_detail']);
        }
        if($data['approveMoney'] == 1){
            $l_fee = new LoanFee();
            $r = $l_fee->ApproveLoanMoney($data['approve_id'], $data['userID'], $data['approve_state'], $data['money_opinion']['app_opinion'], $data['money_opinion']['app_opinion_detail']);
        }
        $result_array['state'] = 1;
        $result_array['state_error'] = '';
    }else{
        $result_array['state'] = 0;
        $result_array['state_error'] = 'DB_ERROR';
    }

    echo json_encode($result_array);






?>